package org.dei.perla.sys.environments;

import java.util.*;

import org.dei.perla.component.Startable;
import org.dei.perla.parser.statements.Statement;
import org.dei.perla.sys.device.fpc.FunctionalityProxyComponent;
import org.dei.perla.sys.query.llqruntime.datacollection.LLStack;

public class LLEnvironment extends Environment implements Startable{

	private ArrayList<LLStack> pStacks;
	
	public LLEnvironment() {
		pStacks = new ArrayList<LLStack>();
	}
	
	@Override
	public Statement getRepresentedQuery() {
		return this.pStacks.get(0).getDataCollector().getLLDataCollectionInfo().getRepresentedStatement();
	}
	
	public Iterator<FunctionalityProxyComponent> getActiveFPCs() {
		ArrayList<FunctionalityProxyComponent> tArray = new ArrayList<FunctionalityProxyComponent>();
		
		for (LLStack tStack : pStacks) {
			tArray.add(tStack.getDataCollector().getLLDataCollectionInfo().getAssociatedFPC());
		}
		
	return tArray.iterator();
	}
	
	public ArrayList<LLStack> getActiveLLStacks() {
		return this.pStacks;
	}
	
	public void addStackToEnvironment(LLStack parStack) {
		this.pStacks.add(parStack);
	}

	public boolean isStarted() {
		return false;
	}


	public void start() {
		for (LLStack tStack : pStacks) {
			tStack.start();
		}
		
	}

	public void stop() {
		// TODO Auto-generated method stub
		
	}
}
